<?php
require_once('App-Top.php');
require_once('Authorizer.php');
require_once('GenFunctions.php');
require_once('DBConfigQuery.php');
require_once('../config.inc.php');
require_once('../Validation.php');

// Check if it is Member Mng
if (isset($_SESSION['SESS_USER_TYPE'])) {
    if (!isUserType_Members($_SESSION['SESS_USER_TYPE'])) {
        header("Location: AdminIndex.php");
        exit();
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Treasurer Reset Payment</title>
        <link href="StyleControl.css" rel="stylesheet" type="text/css" />
    </head>
    <body>

        <div id="sidebar">
            <h3>Reports</h3>
            <ul>
                <li><a href="#">Gate List</a></li>
                <li><a href="#">Members List</a></li>
            </ul>


            <?php
            require_once('MenuAdmin.php');
            ?>
        </div>

        <div id="mainbody">

            <?php

            if (isset($_POST['CancelReset'])) {
                session_write_close();
                header('Location: AdminIndex.php');
                exit();
            }

            
            if (isset($_POST['ConfirmResetAllPMT'])) 
            {
                // Confirmation of Reset Payment

                $r = mysqli_query($dbc, $U_ResetPMT_Membership) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));
                if ($r) {
                    mysqli_close($dbc);
                    session_write_close();

                    echo '<h1>Reset Payment Success</h1> <br />';

                    echo '<p>All Payment information was Reset. Hence, Every Member has not paid!.</p>';
                    echo '<p>Please select one of the Links from the Menu on the Left.</p>';
                 }
                 else
                 {
                   // Free DB
                    mysqli_close($dbc);
                    die("Query failed");
                 }
            }
            elseif (isset($_POST['ResetAllPMT']))
            {
                // Confirmation form for Reset Payment

                echo '<h1>Reset Payment Confirmation</h1> <br />';

                echo '<h4>If you are completely sure that you want to Reset all Payments, please click Confirm Reset Payments.</h4> <br />';
                echo '<h4>There is no going back after you confirm.</h4> <br />';

                echo '<form id="resetConfirmPMTForm" name="resetConfirmPMTForm" method="POST" action="AdminResetPay.php">';
                echo    '<input type="submit" name="CancelReset" value="Cancel Reset" class="button"/>';
                echo    '<input type="submit" name="ConfirmResetAllPMT" value="Confirm Reset Payments" class="button"/>';
                echo '</form>';
                
            }
            else
            {
                // Initial Prompt form for Reset Payment

                echo '<h1>Reset Payment</h1> <br />';

                echo '<h4>If you want to reset all payment information, please click Reset Payments.</h4> <br />';

                echo '<form id="resetPMTForm" name="resetPMTForm" method="POST" action="AdminResetPay.php">';
                echo    '<input type="submit" name="CancelReset" value="Cancel Reset" class="button"/>';
                echo    '<input type="submit" name="ResetAllPMT" value="Reset Payments" class="button"/>';
                echo '</form>';
            }

            ?>

            
        </div>

    </body>
</html>
<?php

    require_once('App-End.php');
?>

<!-- Designed: Jose Trujillo - 2011 -->